﻿@model Tasks.UI.Models.Hotel.HotelBaseDateModel
@{
    Layout = "~/Views/Account/_AccountMaster.cshtml";
}
@section head{
    <style type="text/css">
        /*------------------------酒店管理-----------------------------------------------*/
        .hotel_list
        {
            padding: 10px;
            margin-top: 20px;
            border: 1px solid #e4dfdf;
        }
        .hotel_list_img
        {
            padding: 3px 6px 9px;
            width: 130px;
            float: left;
            height: 94px;
            background: url(/images/album_upload_dtbg.jpg) no-repeat;
        }
        .hotel_list_js
        {
            margin-left: 10px;
        }
        .hotel_list_js h3
        {
            font-size: 24px;
            color: #1b74ae;
            font-family: "黑体";
        }
    </style>
    <script type="text/javascript">

        //init
        $(function () {
            datePicker("#InTime1");
            datePicker("#InTime2");

            initProvince("#ProvinceID");
            initCity("#CityID");
            initTable(".tblStyle1");
        })

        function setState(hotelID, state) {
            $("#HotelID").val(hotelID);
            goto(state);
        }

        function goto(act) {
            $("#act").val(act);
            document.forms[0].submit();
        }

        function showRoom(hotelID) {
            $("#roomList" + hotelID).toggle();
        }
        //删除数据
        function ConfirmDel(hotelID) {
            $.Msg.confirmDelete(
             function () {
                 $("#HotelID").val(hotelID);
                 goto("delete");
             }
        );
        }
    </script>
}
@using (Html.BeginForm())
{
    <input id="act" name="act" type="hidden" />
    <input id="HotelID" name="HotelID" type="hidden" />
     
    <div class="navTitle">
        酒店管理</div>
    <div class="searchBar">
        <table>
            <tr>
                <td style="width: 80px;">
                    <strong>酒店名称：</strong>
                </td>
                <td style="width: 250px;">
                    @Html.TextBoxFor(t => t.HotelName)
                </td>
                <td style="width: 80px;">
                    <strong>所在城市: </strong>
                </td>
                <td>
                    @Html.DropDownList("ProvinceID", PageHelper.ProvinceSelector(Model.ProvinceID))
                    @Html.DropDownList("CityID", PageHelper.CitySelector(Model.CityID, Model.ProvinceID))
                    @Html.DropDownList("AreaID", PageHelper.AreaSelector(Model.AreaID, Model.CityID))
                </td>
            </tr>
            <tr>
                <td>
                    <strong>酒店级别：</strong>
                </td>
                <td colspan="3">
                    @Html.DropDownListExt("HotelLevel", PageHelper.HotelLevelSelector(Model.HotelLevel))
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input id="btnSearch" type="button" value="查询" onclick="goto('search')" class="btnSearch" />
                    <a href="javascript:void(0)" onclick="openTab('添加酒店','/Account/HotelEdit',true)">添加酒店</a>
                </td>
                <td>
                </td>
                <td>
                </td>
            </tr>
        </table>
        <div class="bottom">
        </div>
    </div>

    <table border="0" cellspacing="0" cellpadding="0" class="tblStyle1">
        <thead>
            <tr align="center">
                <th style="width: 10%">
                    省市
                </th>
                <th style="width: 10%">
                    酒店名称
                </th>
                <th style="width: 10%">
                    星级
                </th>
                <th style="width: 10%">
                    付款方式
                </th>
                <th style="width: 10%">
                    联系人
                </th>
                <th style="width: 10%">
                    联系电话
                </th>
                <th style="width: 10%">
                    前台电话
                </th>
                <th style="width: 10%">
                    传真
                </th>
                <th style="width: 10%">
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (Hotel hotel in Model.Hotels)
            {
                if (hotel.Contact == null)
                {
                    hotel.Contact = new ContactInfo();
                }
                <tr align="center">
                    <td>
                        @hotel.Contact.Position
                    </td>
                    <td>
                        @hotel.Name
                    </td>
                    <td>@PageHelper.HotelLevelToStr(hotel.Level)
                    </td>
                    <td>@CommonUtil.GetEnumDescription(typeof(EnterprisePaymentMode), hotel.PaymentMode)
                    </td>
                    <td>@hotel.Contact.Linkman
                    </td>
                    <td>@hotel.Contact.LinkmanTel
                    </td>
                    <td>@hotel.ReceiveTel
                    </td>
                    <td>@hotel.Contact.Fax
                    </td>
                    <td width="200" valign="bottom">
                        <a href="javascript:void(0)" onclick="openTab('编辑酒店','/Account/HotelEdit?HotelID=@hotel.HotelID',true)">
                            <img src="/images/icon/16x16/file_edit.png" title="编辑" /></a> <a href="javascript:;" onclick="ConfirmDel(@hotel.HotelID)">
                                <img src="/images/icon/16x16/delete.png" title="删除" /></a>
                        @if (hotel.State == (int)HotelState.不可售)
                        {
                            <a href="javascript:;" onclick="setState(@hotel.HotelID,'tostart')">
                                <img src="/images/icon/16x16/enable.png" title="启用" /></a>
                        }
                        @if (hotel.State == (int)HotelState.可售)
                        {
                            <a href="javascript:;" onclick="setState(@hotel.HotelID,'blockup')">
                                <img src="/images/icon/16x16/stop.png" title="禁用" /></a>
                        }
                    </td>
                </tr>
            }
        </tbody>
    </table>

    @Html.RenderPageNav(Model.PageIndex, Model.PageSize, Model.RowCount, "", PageNavStyle.Form)
  
        
}
